import os, sys
from _util import run_cmd

os.putenv('PYTHON', sys.executable)
PYTHON_BINARY = sys.executable
PYTHON_BIN_PATH = os.path.dirname(sys.executable)
os.putenv('PYTHON_BIN_PATH', PYTHON_BIN_PATH)

basedir = os.path.abspath(os.path.dirname(__file__))
if len(sys.argv) == 1:
	name = 'Django'
else:
	name = sys.argv[1]
script = os.path.join(basedir, name + '.sh')
if not os.path.exists(script):
    print 'Unknown project: %s' % (name,)
    sys.exit(1)
cmd = script
print "Running", cmd
rc, output = run_cmd(cmd)
print output
print "Exit code:", rc
sys.exit(rc)
